# ============================================================================
# Helloworld Client Subproject
# ============================================================================
# Note: Common configurations are inherited from parent CMakeLists.txt:
#   - CMake version, C++ standard
#   - TRPC paths, include/link directories
#   - PB_PROTOC, TRPC_CPP_PLUGIN, LIBRARY variables
# ============================================================================
# ============================================================================
# Client Executables
# ============================================================================

# Fiber-based client
add_executable(fiber_client 
    ${CMAKE_CURRENT_SOURCE_DIR}/fiber_client.cc
    ${OUT_PB_SRCS}
    ${OUT_TRPC_PB_SRCS}
)

target_link_libraries(fiber_client 
    PRIVATE
        service_common 
        ${LIBRARY}
)

# Set RPATH for runtime library search
set_target_properties(fiber_client PROPERTIES
    INSTALL_RPATH "$ORIGIN/lib"
    BUILD_WITH_INSTALL_RPATH FALSE
    INSTALL_RPATH_USE_LINK_PATH TRUE
)

# Future-based client
add_executable(future_client  
    ${CMAKE_CURRENT_SOURCE_DIR}/future_client.cc
    ${OUT_PB_SRCS}
    ${OUT_TRPC_PB_SRCS}
)

target_link_libraries(future_client 
    PRIVATE
        service_common 
        ${LIBRARY}
)

# Set RPATH for runtime library search
set_target_properties(future_client PROPERTIES
    INSTALL_RPATH "$ORIGIN/lib"
    BUILD_WITH_INSTALL_RPATH FALSE
    INSTALL_RPATH_USE_LINK_PATH TRUE
)
# ============================================================================
# Installation Rules
# ============================================================================
install(TARGETS fiber_client 
        RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/../runtime/bin/client_helloworld)

install(TARGETS future_client 
        RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/../runtime/bin/client_helloworld)
